<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-16 16:52:08
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-16 16:54:40
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 编写函数has(arr , 60) 判断数组中是否存在60这个元素，返回布尔类型 -->
    <script>
        function has(arr,num){
            for(var i=0;i<arr.length;i++){
                if(arr[i]===num){
                    return true;
                }
            }
            return false;
        }
        var arr = [1, 2, 3, 60]
        var arr2 = [1, 2, 3]
        console.log(has(arr, 60));
        console.log(has(arr2, 60)) // false
        
    </script>
</body>
</html>